package de.uni.bremen.estudent.lbs.fragments;


import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import com.google.android.maps.MapView;

import de.uni.bremen.estudent.lbs.R;


/**
 * @author bahlfeld
 */
public final class MapViewFragment extends Fragment {

    /**
     * Mapview object.
     */
    private MapView mMap;

    @Override
    public void onActivityCreated(final Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        mMap = new MapView(getActivity(),this.getString(R.string.certificate_api_key));
        mMap.setClickable(true);

        // TODO: Letzte Position ermitteln...
        // mMap.getController().setCenter(new GeoPoint(arg0, arg1));

        mMap.setBuiltInZoomControls(true);

        ((ViewGroup) getView()).addView(mMap);
    }

    /*
     * (non-Javadoc)
     *
     * @see android.app.Fragment#onCreateView(android.view.LayoutInflater,
     * android.view.ViewGroup, android.os.Bundle)
     */
    @Override
    public View onCreateView(final LayoutInflater inflater,
                             final ViewGroup container,
                             final Bundle savedInstanceState) {
        return (new FrameLayout(getActivity()));
    }
}
